package com.jyx.cloud.controller;

import com.jyx.cloud.entity.CommonResult;
import com.jyx.cloud.entity.Member;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author jyx
 * @version 1.0
 * @email jiangyongxing@myzczk.com
 * @company www.myzczk.com
 * @create-time 2020/5/28 10:33
 */

@RestController
@Slf4j
public class CustomerController {

    private static final String MEMBER_URL = "http://CLOUD-MEMBER-SERVER/member/";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping(value = "/customer/member/get/{id}")
    public CommonResult<Member> getMember(@PathVariable("id") String id){
        return restTemplate.getForObject(MEMBER_URL+"get/"+id, CommonResult.class);
    }

}
